From: Sam Spilsbury Date: Tue, 13 Jun 2017 16:43:20 +0000 (+0800) Subject: util: Import notifyError dynamically when needed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~226^2^2~147 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4711f6eee4de35c05a86a07b31178483b4bfb064;p=gnome-shell.git util: Import notifyError dynamically when needed For unit tests, it is best not to pull in UI related code. https://bugzilla.gnome.org/show_bug.cgi?id=783738 Part-of: --- diff --git a/js/misc/util.js b/js/misc/util.js index 508c87d24..161733b5d 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -6,7 +6,6 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import GnomeDesktop from 'gi://GnomeDesktop'; -import * as Main from '../ui/main.js'; import {formatTime} from './dateUtils.js'; // http://daringfireball.net/2010/07/improved_regex_for_matching_urls @@ -184,8 +183,10 @@ export function trySpawnCommandLine(commandLine) { } function _handleSpawnError(command, err) { - let title = _('Execution of “%s” failed:').format(command); - Main.notifyError(title, err.message); + const title = _('Execution of “%s” failed:').format(command); + // Use dynamic import to not pull in UI related code in unit tests + import('../ui/main.js').then( + ({notifyError}) => notifyError(title, err.message)); } /**